<!--内容区开始-->
 <div class="cont">
    <div class="position"><img alt="位置图标" src="dist/images/position.png" />财务管理&gt;退款处理<a ng-click="openDetail('',index_key)" ng-hide="$needClientCache" title="打开新窗口查看"><i class="large External icon"></i></a></div>
    <div class="mybackground">
        <div class="cont_fr_top">
            <div class="menus_top">
                <div class="menus_l"><b>退款状态:</b></div>
                <ul id="nav">
                    <li ng-if="search_param.status ==-1" class="selected"><a>全部</a></li>
                    <li ng-if="search_param.status !=-1"><a ng-click="search_param.status=-1">全部</a></li>
                    <li ng-if="search_param.status ==0" class="selected"><a>待处理</a></li>
                    <li ng-if="search_param.status !=0"><a ng-click="search_param.status=0">待处理</a></li>
                    <li ng-if="search_param.status ==10" class="selected"><a>已取消</a></li>
                    <li ng-if="search_param.status !=10"><a ng-click="search_param.status=10">已取消</a></li>
                    <li ng-if="search_param.status ==20" class="selected"><a>申请失败</a></li>
                    <li ng-if="search_param.status !=20"><a ng-click="search_param.status=20">申请失败</a></li>
                    <li ng-if="search_param.status ==30" class="selected"><a>风控确认</a></li>
                    <li ng-if="search_param.status !=30"><a ng-click="search_param.status=30">风控确认</a></li>
                    <li ng-if="search_param.status ==31" class="selected"><a>退款失败</a></li>
                    <li ng-if="search_param.status !=31"><a ng-click="search_param.status=31">退款失败</a></li>
                    <li ng-if="search_param.status ==40" class="selected"><a>退款成功</a></li>
                    <li ng-if="search_param.status !=40"><a ng-click="search_param.status=40">退款成功</a></li>
                </ul>
            </div>
            <!-- 查询条件开始 -->
            <div class="menus" >
                <div class="menus_con ui form">
                    <div class="four fields">
                        <div class="inline field">
                            <label>退款客户</label>
                            <input type="text" ng-Model="search_param.customer"  ng-keyup="enterSearch($event)"  placeholder="客户名/电话/编码" maxlength="15" style="width: 160px">
                        </div>
                        <div class="inline field">
                            <label>业务人员</label>
                            <input type="text" ng-Model="search_param.sales"  ng-keyup="enterSearch($event)"  placeholder="业务人员" style="width: 160px">
                        </div>
                        <div class="inline field">
                            <label>退款申请时间</label>
                            <div class="ui left icon input">
                            <input ng-model="search_param.stime" placeholder="开始时间" datetimepicker format="YYYY-MM-DD" id="firstTime" style="width:160px;height: 32px">
                            <i class="calendar icon"></i>
                            </div>
                        </div>
                        <div class="inline field">
                            <div class="ui left icon input">
                            <input ng-model="search_param.etime" placeholder="结束时间" datetimepicker format="YYYY-MM-DD"
                                id="secondTime" style="width:160px;height: 32px">
                            <i class="calendar icon"></i>
                            </div>
                        </div>
                    </div>
                    <div class=" fields">
                        <div class="inline field">
                            <button class="clear_btn" ng-click="search()" style="margin-left: 4.5em"> 查找</button>
                        </div>
                    </div>
                </div>
            </div>
            <!-- //查询条件结束 -->
        </div>
        <!-- 列表业数据开始 -->
            <div class="menus_table">
                <table class="ui celled yellow striped table">
                     <thead>
                        <tr>
                            <th>退款编号</th>
                            <th>申请时间</th>
                            <th>客户姓名</th>
                            <th>客户电话</th>
                            <th>业务人员</th>
                            <th>团队经理</th>
                            <th>所属团队</th>
                            <th>退款金额</th>
                            <th>退款原因</th>
                            <th>状态</th>
                            <th>备注</th>
                            <th class="center aligned">处理</th>
                        </tr>
                    </thead>
                    <tbody ng-show="refunds&&refunds.length>0">
                        <tr ng-repeat="vitem in refunds ">
                                <td>{{vitem.refund_id}}</td>
                                <td>{{vitem.create_time|limitTo:10}}</td>
                                <td>{{vitem.customer_name}}</td>
                                <td>{{vitem.phone}}</td>
                                <td>{{vitem.sales_name}}</td>
                                <td>{{vitem.manager_name}}</td>
                                <td>{{vitem.team}}</td>
                                <td class="right aligned">
                                    <b>{{vitem.pay_mount|currency:'':2}}</b>
                                </td>
                                <td>{{vitem.reason}}</td>
                                <td>
                                    <span refund-status status="{{vitem.status}}"> </span>
                                </td>
                                <td>{{vitem.remark}}</td>
                                <td class="center aligned">
                                    <a ng-click="payConfirm(vitem.refund_id)" ng-if="vitem.status==30">审核</a>
                                    <a ng-click="payDetail(vitem.refund_id)" ng-if="vitem.status==40">查看详情</a>
                                </td>
                            </tr>
                        </tbody>

                </table>
                <div class="ui row" ng-if="refunds.length==0">
                    <p style="text-align:center;color:red;">没有找到数据~~~</p>
                </div>
                <div class="ui pagination menu" jspagination  ng-if="refundPage.pageAll>1" page-object="refundPage" page-func="refundList" ></div>
        </div>
        <!-- //列表业数据结束 -->
    </div>
 <!--内容区结束-->

<!-- 打款确认弹出框开始 -->
<div class="ui payConfirm modal">
  <i class="close icon"></i>
  <div class="header_h4">打款确认</div>
  <div class="content">
    <form class="popup payConfirm form" >
        <div class="ui form">
            <div class="ui label">
                <i class="info icon"></i>退款基本信息
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>客户姓名：</label>
                    <div>{{confirmData.refund.customer_name}}</div>
                </div>
                <div class="five wide field">
                    <label >客户电话：</label>
                    <div>{{confirmData.refund.phone}}</div>
                </div>
                <div class="five wide field">
                    <label  >退款总金额：</label>
                    <div><b>{{confirmData.refund.pay_mount|currency:'':2}}</b></div>
                </div>
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>业务人员：</label>
                    <div>{{confirmData.refund.sales_name}}</div>
                </div>
                <div class="five wide field">
                    <label>团队经理：</label>
                    <div>{{confirmData.refund.manager_name}}</div>
                </div>
                <div class="five wide field">
                    <label >所属团队：</label>
                    <div>{{confirmData.refund.team}}</div>
                </div>
            </div>
            <!-- <div class="inline fields">
                <div class="five wide field">
                    <label>合同回收状态：</label>
                    <div>{{confirmData.refund.contract_recycle}}</div>
                </div>
                <div class="five wide field">
                    <label>发票状态：</label>
                    <div>{{confirmData.refund.invoice_recycle}}</div>
                </div>
                <div class="five wide field">
                    <label >退款协议：</label>
                    <div>{{confirmData.refund.sign_status}}</div>
                </div>
            </div> -->
            <div class="inline fields">
                <div class="sixteen wide field">
                    <label>退款备注：</label>
                    <div>{{confirmData.refund.remark}}</div>
                </div>
            </div>
            <br/>
            <div class="ui label">
                <i class="browser icon"></i>退款流水信息
            </div>
            <table class="ui striped table">
                <thead>
                    <tr>
                        <th>打款人</th>
                        <th>打款时间</th>
                        <th>打款方式</th>
                        <th>打款金额</th>
                        <th>业务人员</th>
                        <th>团队经理</th>
                        <th>所属团队</th>
                        <th>累计退款</th>
                        <th>本次退款</th>
                        <th>付款状态</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="vp in confirmData.pays">
                        <td>{{vp.pay_name}}</td>
                        <td>{{vp.pay_time|limitTo:10}}</td>
                        <td>{{vp.pay_way}}</td>
                        <td>{{vp.pay_mount|currency:'':2}}</td>
                        <td>{{vp.sales_name}}</td>
                        <td>{{vp.manager_name}}</td>
                        <td>{{vp.team}}</td>
                        <td>{{vp.pmount|currency:'':2}}</td>
                        <td>{{vp.refund_mount|currency:'':2}}</td>
                        <td>
                            <span ng-if="vp.audit_res==0">待审核</span>
                            <span ng-if="vp.audit_res==1">审核成功</span>
                            <span ng-if="vp.audit_res==2">审核失败</span>
                        </td>
                    </tr>
                </tbody>
            </table>
            <br/>
            <div class="ui label">
                <i class="money icon"></i>客户退款账户信息
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>开户姓名：</label>
                    <div>{{confirmData.refund.payee_name}}</div>
                </div>
                <div class="five wide field">
                    <label>开户帐号：</label>
                    <div>{{confirmData.refund.payee_account }}</div>
                </div>
                <div class="five wide field">
                    <label >开户行信息：</label>
                    <div>{{confirmData.refund.payee_way}}</div>
                </div>
            </div>
             <br/>
             <div class="ui label">
                <i class="credit card alternative icon"></i>公司退款财务信息
            </div>
            <div class="fields">
                <input type="hidden" name="type" value="0" />
                <div class="five wide field">
                    <label class="label_fl">公司打款账户：</label>
                    <input name="confirm[pay_name]"  style="width:160px;"  placeholder="银行帐号信息"  type="text" ng-model="confirmData.refund.pay_name" />
                </div>
                <div class="five wide field">
                    <label class="label_fl">公司打款方式：</label>
                    <input name="confirm[pay_way]"  style="width:160px;" placeholder="开户行"  type="text" ng-model="confirmData.refund.pay_way" />
                </div>
                <div class="five wide field">
                    <label class="label_fl" >退款时间：</label>
                    <input name="confirm[pay_time]"  style="width:160px;"   format="YYYY-MM-DD" id="start_time" placeholder="退款时间" datetimepicker  type="text" ng-model="confirmData.refund.pay_time" />
                </div>
            </div>
            <div class="sixteen wide field required">
                    <label class="label_fl">审核信息</label>
                    <textarea rows="2" type="text" name="fn_audit_msg" ng-model="confirmData.refund.finance_audit_msg"  placeholder="打款财务流水或者拒绝通过理由"></textarea>
                </div>
        </div>
    </form>
    </div>
    <div class="actions">
        <button class="ui green button positive" style="width:8em;">确认打款</button>
        <button class="ui grey button negative" style="width:8em;">拒绝打款</button>
    </div>
</div>
<!-- //打款确认弹出框结束 -->

<!-- 退款详情弹出框弹出框开始 -->
<div class="ui refundDetail modal">
  <i class="close icon"></i>
  <div class="header_h4">退款详情</div>
  <div class="content">
    <form class="popup form" >
        <div class="ui form">
            <div class="ui label">
                <i class="info icon"></i>退款基本信息
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>客户姓名：</label>
                    <div>{{detailData.refund.customer_name}}</div>
                </div>
                <div class="five wide field">
                    <label >客户电话：</label>
                    <div>{{detailData.refund.phone}}</div>
                </div>
                <div class="five wide field">
                    <label  >退款总金额：</label>
                    <div><b>{{detailData.refund.pay_mount|currency:'':2}}</b></div>
                </div>
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>业务人员：</label>
                    <div>{{detailData.refund.sales_name}}</div>
                </div>
                <div class="five wide field">
                    <label>团队经理：</label>
                    <div>{{detailData.refund.manager_name}}</div>
                </div>
                <div class="five wide field">
                    <label >所属团队：</label>
                    <div>{{detailData.refund.team}}</div>
                </div>
            </div>
            <!-- <div class="inline fields">
                <div class="five wide field">
                    <label>合同回收状态：</label>
                    <div>{{detailData.refund.contract_recycle}}</div>
                </div>
                <div class="five wide field">
                    <label>发票状态：</label>
                    <div>{{detailData.refund.invoice_recycle}}</div>
                </div>
                <div class="five wide field">
                    <label >退款协议：</label>
                    <div>{{detailData.refund.sign_status}}</div>
                </div>
            </div> -->
            <div class="inline fields">
                <div class="sixteen wide field">
                    <label>退款备注：</label>
                    <div>{{detailData.refund.remark}}</div>
                </div>
            </div>
            <br/>
            <div class="ui label">
                <i class="browser icon"></i>退款流水信息
            </div>
            <table class="ui striped table">
                <thead>
                    <tr>
                        <th>打款人</th>
                        <th>打款时间</th>
                        <th>打款方式</th>
                        <th>打款金额</th>
                        <th>业务人员</th>
                        <th>团队经理</th>
                        <th>所属团队</th>
                        <th>累计退款</th>
                        <th>本次退款</th>
                        <th>付款状态</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="vp in detailData.pays">
                        <td>{{vp.pay_name}}</td>
                        <td>{{vp.pay_time|limitTo:10}}</td>
                        <td>{{vp.pay_way}}</td>
                        <td>{{vp.pay_mount|currency:'':2}}</td>
                        <td>{{vp.sales_name}}</td>
                        <td>{{vp.manager_name}}</td>
                        <td>{{vp.team}}</td>
                        <td>{{vp.pmount|currency:'':2}}</td>
                        <td>{{vp.refund_mount|currency:'':2}}</td>
                        <td>
                            <span ng-if="vp.audit_res==0">待审核</span>
                            <span ng-if="vp.audit_res==1">审核成功</span>
                            <span ng-if="vp.audit_res==2">审核失败</span>
                        </td>
                    </tr>
                </tbody>
            </table>
            <br/>
            <div class="ui label">
                <i class="money icon"></i>客户退款账户信息
            </div>
            <div class="inline fields">
                <div class="five wide field">
                    <label>开户姓名：</label>
                    <div>{{detailData.refund.payee_name}}</div>
                </div>
                <div class="five wide field">
                    <label>开户帐号：</label>
                    <div>{{detailData.refund.payee_account }}</div>
                </div>
                <div class="five wide field">
                    <label >开户行信息：</label>
                    <div>{{detailData.refund.payee_way}}</div>
                </div>
            </div>
             <br/>
             <div class="ui label">
                <i class="credit card alternative icon"></i>公司退款财务信息
            </div>
            <div class="inline fields">
                <input type="hidden" name="type" value="0" />
                <div class="five wide field">
                    <label >公司打款账户：</label>
                    <div>{{detailData.refund.pay_name}}</div>
                </div>
                <div class="five wide field">
                    <label >公司打款方式：</label>
                    <div>{{detailData.refund.pay_way}}</div>
                </div>
                <div class="five wide field">
                    <label class="label_fl" >退款时间：</label>
                    <div>{{detailData.refund.pay_time}}</div>
                </div>
            </div>
            <div class="sixteen wide field">
                    <label class="label_fl">审核信息</label>
                    <textarea rows="2" type="text"   ng-readonly="true" >{{detailData.refund.finance_audit_msg}}</textarea>
                </div>
        </div>
    </form>
    </div>
    <div class="actions">
        <button class="ui green button positive" >关闭</button>
    </div>
</div>
<!-- //退款详情弹出框结束 -->

</div>
<script type="text/javascript">
    $(function(){
        $.fn.form.settings.rules.emptyExtra = function( value ) {
            var isCheck = $('input[name="type"]').val();
            isValid = 0==isCheck ? true :(value ? true :false);
            return isValid;
        };
        $('.payConfirm.form').form({
            on:"blur",
            inline:true,
            fields: {
                fn_audit_msg: {
                    identifier: 'fn_audit_msg',
                    rules: [
                    {
                        type   : 'empty',
                        prompt : '退款确定审核信息不能为空'
                    }
                    ]
                },
                pay_name: {
                identifier: 'confirm[pay_name]',
                rules: [
                    {
                        type   : 'emptyExtra',
                        prompt : '公司打款帐号不能为空'
                    }
                    ]
                },
                pay_way: {
                identifier: 'confirm[pay_way]',
                rules: [
                    {
                        type   : 'emptyExtra',
                        prompt : '公司打款方式不能为空'
                    }
                    ]
                },
            }
        });
    });
</script>